#include"http.hpp"
#include<iostream>

void Login(Http_Request& req,Http_Responce* resp)
{
    std::string text=req.Getparameter();
    resp->SetText(text);
    resp->Setcode(200);
    resp->SetHandle("Content-Length",std::to_string(text.size()));
    resp->SetHandle("Content-Type","text/plain");
    //resp->MakeResponse
}
int main(int argc,char* argv[])
{
    if(argc!=2)
    {
        std::cout<<"Usage: "<<argv[0]<<" server_port"<<std::endl;
        return 1;
    }

    uint16_t port=std::stoi(argv[1]);
    std::unique_ptr<Http> http=std::make_unique<Http>(port);

    http->Register_Actins("/login",Login);
    http->Start();
}